﻿@model System.Collections.Generic.IEnumerable<Smartflow.Elements.Transition>
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>审批流程控件</title>
    <style type="text/css">
        .table-cm {
            width: 120px;
            font-size: 14px;
            font-family: "Lucida Grande", Lucida Sans Unicode,Hiragino Sans GB, WenQuanYi Micro Hei, Verdana, Aril, sans-serif;
            font-size: 14px;
            color: #301c1c;
        }

        textarea {
            resize: none !important;
            width: 99%;
            height: 40px;
            padding: 2px;
            outline: none;
        }

        select {
            width: 100%;
            height: 25px;
            padding: 2px;
            outline: none;
        }

        .layui-form {
            width: 100%;
            padding: 10px;
        }

        .form-table {
            width: 100%;
        }
    </style>
    <script src="~/Content/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#btnOk").click(function () {
                var transition = $("#ddlOperate option:selected"),
                    transitionID = $(transition).val(),
                    to = transition.attr("to"),
                    action = transition.attr("action");

                var description = $.trim($("#txtDescription").val());
                if (description) {
                    $.ajax({
                        url: '@Url.Action("Jump", "UserControl")',
                        type: 'post',
                        traditional: true,
                        data: {
                            instanceID: '@ViewBag.InstanceID',
                            transitionID: transitionID,
                            bussinessID: '@ViewBag.bussinessID',
                            bllService: '@ViewBag.bllService',
                            message: description,
                            action: action
                        },
                        success: function () {
                            window.opener.window.doRefresh();
                            window.close();
                        }
                    });

                } else {
                    alert('请填写审批意见');
                }
            });
        });
    </script>
</head>
<body>
    <form class="form-container">
        <table class="form-table">
            <tr>
                <td class="table-cm">下一步操作</td>
                <td>
                    <select id="ddlOperate">
                        @foreach (var item in Model)
                        {
                            <option to="@item.DESTINATION" value="@item.NID" action="jump">@item.APPELLATION</option>
                        }
                        @if (!ViewBag.CheckResult)
                        {
                            <option to="0" value="0" action="rollback">原路退回</option>
                        }
                    </select>
                </td>
            </tr>
            <tr>
                <td class="table-cm">审批意见</td>
                <td style="position:relative;">
                    <textarea class="layui-textarea" id="txtDescription"></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align:center;">
                    <input type="button" id="btnOk" value="确定" class="layui-btn" />
                    <input type="button" id="btnClose" value="关闭" onclick="window.close()" class="layui-btn layui-btn-normal" />
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
